<template>
  <KView class="bargain-progress">
    <KView class="bargain-progress-line"></KView>
    <KView class="bargain-progress-div" :style="progressStyle"></KView>
  </KView>
</template>

<script>
  import SystemUtil from 'utils/systemUtil';

  export default {
    props: {
      bargain: {
        type: Object,
        required: true
      }
    },

    computed: {
      progressStyle() {
        let bargain = this.bargain;
        let rate = bargain.discountedRate;
        if (rate !== 0) {
          rate = -rate;
        }
        return {
          left:`${rate}%`
        };
      }
    },

    data() {
      return {};
    }
  };

</script>

<style lang="scss">
  .bargain-progress {
    height: formatPx(16);
    border-radius: formatPx(8);
    position: relative;
    overflow: hidden;

    >div {
      position: absolute;
      top: 0;
    }

    .bargain-progress-line {
      left: 0;
      width: calc(100% - 2px);
      height: calc(100% - 2px);
      border: 1px solid #ff6f2f;
      border-radius: formatPx(8);
    }

    .bargain-progress-div {
      width: 100%;
      height: 100%;
      border-radius: formatPx(8);
      background: #ff6f2f;
    }
  }

</style>
